package cn.wolfcode.luowowo.website.util;

import cn.wolfcode.luowowo.article.domain.Destination;
import cn.wolfcode.luowowo.article.service.IDestinationService;
import org.springframework.ui.Model;

import java.util.List;

public abstract class ControllerUtil {

    /**
     * 设置参数
     *
     * @param model
     * @param id
     */
    public static void setToastsToModel(IDestinationService destinationService, Model model, Long id) {
        List<Destination> toasts = destinationService.getToasts(id);
        model.addAttribute("toasts", toasts);
        model.addAttribute("dest", toasts.remove(toasts.size() - 1));
    }

}
